<%@ page contentType="text/html; charset=UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="path" value="${pageContext.request.contextPath}"></c:set>
<html>
<head>
<title>修改密码</title>
<script type='text/javascript' src="${path }/dwr/engine.js"></script>
<script type='text/javascript' src="${path }/dwr/util.js"></script>
<script language="javascript" type="text/javascript"
	src="${path }/popedom_Manage/js/dwrbase.js"></script>
<script language="javascript" type="text/javascript"
	src="${path }/dwr/interface/UserInfo.js"></script>
<link href="${path }/css/css.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
		function readInfo(){
			UserInfo.findCurrInfoById(function(data){
				if(data){
					$("username").innerHTML=data.username;
					$("name").innerHTML=data.name;
				}else{
					alert("登陆超时，请重新登陆");
				}
			});
		}
		function updateInfo(){
			var password=DWRUtil.getValue("password");
			var newpassword=DWRUtil.getValue("newpassword");
			var repassword=DWRUtil.getValue("repassword");
			if(newpassword==repassword){
			UserInfo.updatePassword(password,newpassword,function(data){
				if(data){
					alert("密码修改成功！");
				}else{
					alert("旧密码输入错误！无权修改");
				}
			});
			}else{
				alert("确认密码与新密码不一致！");
			}
		}
		</script>
</head>
<body onload="initOnload();readInfo()" style="overflow: hidden">
<table border="0" align="center" width="300" cellspacing="1"
	cellpadding="0" class="table" id="formwrapper">
	<tr>
		<td colspan="2" class="title">修改密码</td>
	</tr>
	<tr>
		<td align="right" valign="middle" class="managefont3">用户名：</td>
		<td align="left" valign="middle" class="managefont3" id="username">
		</td>
	</tr>
	<tr>
		<td align="right" valign="middle" class="managefont2">姓名：</td>
		<td align="left" valign="middle" class="managefont2" id="name"></td>
	</tr>
	<tr>
		<td align="right" valign="middle" class="managefont3">旧密码：</td>
		<td align="left" valign="middle" class="managefont3"><input
			name="password" class="input1" maxlength="64" id="password" value=""
			type="password" /></td>
	</tr>
	<tr>
		<td align="right" valign="middle" class="managefont2">新密码：</td>
		<td align="left" valign="middle" class="managefont2"><input
			name="newpassword" class="input1" maxlength="64" id="newpassword"
			value="" type="password" /></td>
	</tr>
	<tr>
		<td align="right" valign="middle" class="managefont3">确认密码：</td>
		<td align="left" valign="middle" class="managefont3"><input
			name="repassword" class="input1" maxlength="64" id="repassword"
			value="" type="password" /></td>
	</tr>
	<tr>
		<td colspan="2" align="center" valign="middle" height="30"><input
			type="button" name="Submit" value="保存" class="buttom"
			onClick="updateInfo()"></td>
	</tr>
</table>
</body>
</html>
